﻿@model Pro260Website.Models.ListingViewModel<Domain.Entity.Game>
@{
    ViewBag.Title = Model.Title;
}


    <h1 class="title @Html.GetColor(Request.Cookies["color"])">@Model.Title</h1>

<br />

<div id="titlelessItem" style="float: right">
</div>
        <br/>
        <table style="text-align: center" class="defaultGrey">
            <tr class="tHeader @Html.GetColor(Request.Cookies["color"])">
                <th>Rank</th>
                <th>Name</th>
                <th>Genre</th>
                <th>Release Year</th>
            </tr>
            @for (int i = 0; i < Model.Items.Count(); i++ )
            {
                 var game = Model.Items.ElementAt(i);
                <tr>
                    <td>@(i+(Model.PagingInfo.ItemsPerPage * (Model.PagingInfo.CurrentPage - 1))+1)</td>
                    <td>@Html.ActionLink(@game.Name, "Game", "Game", new { id = game.Id, viewname = "GameWithLayout" }, null)</td>
                    <td>@game.Genre</td>
                    <td>@game.ReleaseDate.Month/@game.ReleaseDate.Day/@game.ReleaseDate.Year</td>
                </tr>
            }    
        </table>
        <br/><br/>
        <div id="pagerForm" class="pager @Html.GetColor(Request.Cookies["color"])">
         @Html.PageLinks(Model.PagingInfo, i => Url.Action("GamesList", "Game", 
        new { searchFor = Model.QueryInfo.QueryString, page = i, pageSize = Model.PagingInfo.ItemsPerPage,
              type = Model.ViewTypeEnum,
              title = Model.Title,
              viewname = "GameListTable",
              area = ""
        }))
        </div>
    <br/>